package com.yc.c118s3plyspringboot;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class HelloAction {

    @GetMapping("hello")
    public String hello(String name){
        return "hello" + name;
    }

    // @Value("张三")
    @Value("${myinfo.name}")
    private String name;
    @Value("${myinfo.age}")
    private int age;


    // @Value 不支持
    private List<String> likes;

    @GetMapping("myinfo")
    public String myinfo(){
        return name + " " + age;
    }

    @Resource
    MyinfoProperties myinfoProperties;
    @GetMapping("myinfo1")
    public MyinfoProperties myinfo1(){
        return myinfoProperties;
    }

    Logger logger = LoggerFactory.getLogger(getClass());
    @GetMapping("log")
    public void log(){
        logger.debug("==========debug========");
        logger.info("==========info========");
        logger.warn("==========warn========");
        logger.error("==========error========");
    }
}
